This program is well-defined under C++17 or later standard; and exhibits undefined behavior under earlier C++ standard versions.
C++17 introduced two new rules that make it well-defined. First, evaluations of operands of a function call are indeterminately sequenced with respect to each other (as opposed to unsequenced in prior versions). So something like f((x == 0), (x = 0))
was undefined before C++17, and is merely unspecified after.
Second, for certain operators, including shift operators, the order of evaluation of their operands is guaranteed. This is true even when those operators are overloaded and result in a function call; in which case the order of evaluation of its arguments is consistent with that of a corresponding built-in operator.
In short, starting with C++17, the program is equivalent to
std::cout << (x == 0);
std::cout << (x = 0);
and should reliably print 00
. Under prior versions, it exhibits undefined behavior and can print anything at all.