Home C++ How to define an operator that is inside a nested class
 I am having trouble with defining an operator that is within a nested class that is also templated. I understand how to declare and define it within the .h file, but I want to declare it in the .h file and define it in a .hpp file. For example: List.h template class List { public: class const_iterator { //nested class //.... const T & operator*() const; }; };  Now here is the part I don't quite understand: List.hpp #include "List.h" template typename List ::const_iterator & List :: operator*() const //error line { //do stuff }  The error I am receiving on line 4 of the Line.hpp is: Out-of-line definition of 'operator*' does not match any declaration in 'List' I am looking for a solution that involves solely fixing the .hpp file.