I have a template class with separate declaration and implementation:
// template.hpp
template <typename T>
class Foo {
  T _data;
  void func();
};
// template.cpp
#include "template.hpp"
template <typename T>
void Foo<T>::func() {
  // Do something on _data
}
those template files will be compiled into a library, and in another cpp file I link the library and instantiate the template class as follows:
// my.cpp
#include "template.hpp"
struct MyData {
  // Some data here
};
class Bar {
  Foo<MyData> foo;
};
I get linker error when compiling my.cpp file. Is there any way to avoid the linker error by just modifying the template.hpp and template.cpp? 
I don't want to move the template implementation into the header file and I can't move the MyData into template.hpp.
