An expression containing the subscripting operator has syntax
of the form :
identifier [ expression ]
and is considered a binary operator. The operands are identifier and expression. The operator function operator[] must be defined as a nonstatic member function. You cannot declare an overloaded subscript operator that is a nonmember function.
A subscripting expression for the class object x:
x [y]
is interpreted as x.operator[](y). It is not interpreted as operator[](x,y) because it is defined as a nonstatic member function.