The majority of C++’s operators can be overloaded except for:

  • :: scope resolution operator

  • :? ternary conditional operator

  • .* pointer to member operator

  • . dot operator

  • sizeof

Some basic rules for operator overloading:

  • the precedence and associativity of the operator cannot be changed

  • “arity” cannot be changed, which means a binary operator cannot be applied to three arguments or one argument

  • we are not allowed to overload operators for primitive types, e.g., int, double

  • we are not allowed to create new operators

  • C++ allows us to overload operators using global functions or member methods; however, [], (), ->, and = must be implemented as member methods