The accepted answers to the questions here and here say that it's all about operator precedence and thus,
cout << i && j ;
is evaluated as
(cout << i) &&j ;
since the precedence of Bitwise-Operators is greater than that of Logical-Operators. (It's not the bitwise operator here, but it is the symbol itself which is setting the precedence.)
I wonder then why the following code doesn't output 1:
int x=2, y=1 ;
cout << x>y ;
since the precedence of Relational-Operators is greater than Bitwise-Operators; the last line should get treated as cout << (x>y) ;.
I got a warning that overloaded operator<< has higher precedence than a comparison operator.
What is the precedence of overloaded operator<< in comparison to all other existing operators?