The best practice with template functions is to define them in header files. They are created at compile time so compiler has to have definition around to do so.
When export
for templates would be more supported this wouldn't be the case though but right now it still hardly can be used.