Sure, you can use templates in a .cu file and call it from a .cpp file. That is possible, because nvcc supports C++ host code in .cu files (and it is turned on on default). With extern “C” this won’t work, because you force the compiler to use simple C name mangling, but templates make C++ name mangling mandatory. Because you used extern “C” with a template function, I think you do not really know what it does: read this article.
nvcc supports C++ host code, but a template must be known at compile time. So my answer was not completely correct: you cannot define a template-function within a .cu file and use it from a .cpp file (unless you include the .cu in your .cpp). But you can define a template function within a .cu file and use it there. Or you define it in a header (.cuh) and include that one in both files, .cu and .cpp.