I’m really baffled that this used and thus shown as (presumably) good practice in so many of the C++ course videos. For instance in Ultimate C++ Part 3: Advanced - 5- Overloading the stream insertion operator:
You are absolutely right @brokkolibri .
This is a bad practice that should be avoided.
Having said that, you have to look at this from a complete beginner’s point of view.
I believe Mosh was only trying to keep distractions away from new learners and to simplify the code as much as possible, so it is easy to contemplate.