What am I missing? I am just trying to call a function

you need to make it a friend class of the class you want to call something.

Syntax :

class <class_name>    
{    
    friend  <return_type>  <function_name>(argument/s);  
};

if you want to have an example of casting way : Example

2 Likes