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\'
If you want the original code to work, you need to overload the int-cast operator for your class:
operator int() const { return 5; }