operator-> must take no parameters and return a type for which operator-> is already overloaded. At some point at the end of the chain, it will have to return a pointer. It's a bit of a weird operator.
struct Data
{
int var;
};
class Example
{
public:
Data dat;
Data* operator -> ()
{
return &dat;
}
};
int main()
{
Example e;
// The below lines have the same effect:
e->var = 5;
e.dat.var = 5;
}