template <class T> class List { public: void method() {} }; template <class T> class Hash { protected: List<T> *list; public: int index() { return 0; } void function(); }; template <class T> void Hash<T>::function() { list[index()].method(); } int main() { return 0; }