I'm confused about how to use overload operator, My assignment is: You should use the overload operator << so that the printing of the vector can achieved by
cout << v << endl;
Notice that you passed in the "out" ostream here, but never used it.
Do out << stuff; not cout << stuff; inside of your output logic.
This actually won't matter when just normally using the function with standard out, but would matter if you're passing in an ofstream or another kind of ostream somewhere else in the program.
I'm not sure if that answers your question. Is there a particular issue you're trying to resolve, other than that?