I am trying to replicate a vector in my myVec class.
When I declare the subscript operator  overload as non-const, and use it in ostream << operator overload friend function, I get a compiler error saying that I am calling a non-const member function from a const instance. (the argument to ostream operator overload is a const reference to my myVec object.
The above is expected. However, when I check the std::vector and std::string operator  function signatures, they are non-const functions.
What is the standard way of implementing this? Should I change my ostream operator<< overload signature to take a non-const reference? My code is as follows: