Please explain to me why the following piece of code complies and works perfectly. I am very confused.
#include
template
When you write Base<> base; the compiler will try to find out if instantiation of Base<> class is possible or not if it is possible the code would work fine.
In this case it is possible due to the default template argument of Base because the compiler knows if you if you write Base<> it needs to create a object of Base. i.e: because of:
template
class Base
{};
So the code works fine.