#include "iostream"
class Cls {
public:
// Assume Cls has an array-like structure
int operator[](int idx) {
// Provide access to an element
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78467132/in-cpp-how-to-def-operator-in-class[/url]