The restriction is for safety.For example if we overload . operator then we cant access member in normal way for that we have to use ->.
I think the above answer is not appropriate .
According to me all these operators use name instead of operand ,so we can`t pass any name (either of variable,class) to any function . We must have to pass the operand for that .
Nice answer, but it does not suite for :? operator as it does not take name as parameter. BTW, the reason we cannot overload :? is that it takes 3 argument rather than 2 or 1. There is no mechanism available by which we can pass 3 parameter during operator overloading. For other operators, the previous ans is enough.
In any languages all operator has some precedence, due to precedence they work.like +,-,() all have some precedence, as we know operator overloading work differently without changing the specific meaning of the operator and in this case :,?:, etc. have no predefined precedence.And if we want to overload these operator then compiler does not understand and conflicts, and generates an error.
According to Bjarne Stroustrup, the operators ., .* ,:?, :: & sizeof() cannot be overloaded as they take name as their argument whereas all other operators take value as argument.
Class A { public: int i; };
A a,b,c;
Eg: c = a+b - both a & b actually refer to some memory location, so "+" operator can be overloaded, but the "." operator, like a.i actually refers to the name of the variable from whom the memory location has to be resolved at time and thus it cannot be overloaded.