If I am allowed to do the following:
template class Foo{ };
Why am I not allowed to do the following in main?
With C++17, you can indeed.
This feature is called class template argument deduction and add more flexibility to the way you can declare variables of templated types.
So,
template class Foo{}; int main() { Foo f; }
is now legal C++ code.