E2218 Templates can only be declared at namespace or class scope (C++)
Go Up to Compiler Errors And Warnings (C++) Index
Templates cannot be declared inside classes or functions. They are only allowed in the global scope, or file level.
For example:
void func() { template <class T> myClass { // Error T i; }; }