To both get and set container elements using an index you need two index operators, like this:
template <class T> AdvArray {
std::vector<T> array;
public:
void Add(const T& value) { array.emplace_back(value); }
T& operator [] (size_t i) { return array[i]; }
T operator [] (size_t i) const { return array[i]; }
};
The second operator is declared const, and therefore can only be used to read values. The first operator returns a refernce to the stored value and therefore can be used to change values:
AdvArray<int> myarray;
myArray.Add(5); myArray[0] = 6;
If you don't need a setter, you can omit the first operator.