Please explain to me why the following piece of code complies and works perfectly. I am very confused.
#include
template
          
template
class Base
{};
 
Here the default values/initialization for A and B have been declared respectively as int and double.
 template
 class Base 
  
Here in class definitions, the first argument is something like a constant value(here int; why declare this way just making things complex? Better remove the first template argument) and the second template argument is B who default value is 'double'.
Base<> base;
When you create the object of the class. Although you do not specify the template arguments, the compiler takes default values of the arguments(A and B)which are 'int' and 'double' and the code executes without any errors or warnings.
See what happens when you create the object as:
 Base or Base