It just doesnβt exist , so you cannot overload it.
A possible solution is to define two classes: Matrix and String.
You can define operator[] for Matrix to return Row and then define the same operator for Row to return the actual value ( int or whatever you want, your Matrix can also be a template).
Thus, the statement myMatrix[row][col] will be legal and meaningful.
You can do the same to assign a new Row a Matrix or change the value in Row .
* EDIT *
As pointed out in the comments, you should also accept to use operator() instead of operator[] for such a case. Thus, there will no longer be a need for the Row class.
source share