I\'m trying to overload the dereference operator, but compiling the following code results in the error \'initializing\' : cannot convert from \'X\' to \'int\':
\'initializing\' : cannot convert from \'X\' to \'int\'
You should apply dereference operator to a class type. In your code x has a pointer type. Write the following:
x
int t = **x;
or
int t = x->operator*();