Because the implicit conversion operator of cin
is
operator void*() const { ... }
and it can evaluate to zero, so you can check it against zero
while (cin >> x) {}
Conversion operator for bool
declared as explicit
so your expression will not invoke it:
explicit operator bool(){ ... }
So, you need an explicit cast:
if (true == static_cast<bool>(cin >> a))
{
}