A two-dimensional operator identity with application to the change of sign in sums of random variables