In foo.cpp you are specifying the return type and name of the function incorrectly. Node
comes from the class Foo
so you need to qualify it with Foo<T>::
. Same goes with the member function bar
:
template <class T>
typename Foo<T>::Node* Foo<T>::bar( const T & elem );
// ^^^^^^^^ ^^^^^^^^