Your problem is that if
is a runtime if check, and all possible types have to compile, regardless of whether the code could actually ever execute. So when T
is string
, the *
causes the code to fail.
The simplest solution is to provide an overloaded operator<<
that works with pointers and remove the *
:
ostream& operator<< (ostream &wyjscie, Para const* ex)
{
return wyjscie << *ex;
}