template declarations are only permitted at global or namespace scope
You cannot declare a template outside global or namespace scope. If you make your template declarations in an include file, make sure that the include file is at global scope. The following code generates this error:
void main()
{
template <class T> class A {}; // error
}