Operator overloading creates multiple definitions for the same operator. So we can have the '[]' operator do the equivalent of array indexing for a vector, while having it do a hash table access for a map. Operator overloading takes place through the special syntax operator@ (where @ represents the operator being overloaded).
Most C++ operators can be overloaded. The exceptions are: :: (scope resolution), . (member access), .* (member access through pointer to member), and ?: (ternary conditional).
In addition, = (assignment), () (function call), [] (collection access), and -> (member access through pointer) cannot be non-member.
Other than the operators which must be class members, when should we make an operator a class member and when not? The general rule of thumb is:
Code: complex.cpp.
Reference: operator overloading.