The specification template<typename T> only applies to the definition /
declaration which immediately follows it. So it has to be repeated for
every method defined outside the class.
Remember, a template cannot be compiled separately
and then linked to the program.
All of the template definition has to be available to the compiler
when instantiating a template. The easiest but still manageable way to
do this is to still define the methods of a template class in a separate
file (e.g., foo.cpp) and then to include it at the end of the corresponding
header file (e.g., foo.h).