Inconsistent behavior with templates

This may answer your question:
https://isocpp.org/wiki/faq/template…s-defn-vs-decl

The TL;DR is that templated functions must be defined where they are declared.