/* template definition should reside in a header file, just like inline functions */ template class Foo { public: Foo(); Foo(const Foo &); Foo(T &); private: T e; }; template Foo::Foo() : e(0) { } template Foo::Foo(const Foo &f) { this->e = f.e; } template Foo::Foo(T& e) { this->e = e; } int main(int argc, char *argv[]) { Foo foo; return 0; }