Does anyone know why C++ uses the shift operator for streams? It’s always rubbed me the wrong way
If you squint enough, it looks like a fluent interface, just fluent interfaces wouldn't become mainstream until later. That is, "cout << a << b << c;" is pretty close to "cout.print(a).print(b).print(c);"
Another reason to use an operator is that if you use free functions (without variadic parameters) then your parens and nesting stacks up: "print(print(print(cout, a), b), c);"
An infix operator doesn't have that problem.
In modern C++, there is at least the possibility to replace "<<" with something better for printing.
My guess: because it has very low precedence, allowing stuff like:
> cout << a + b * c << " is the result\n";
Instead of:
> cout << (a + b * c) << " is the result\n";