Here $2^A$ is the set of all functions from $A$ to $\{0,1\}$.
This is evidently true if one of $A$, $B$ is finite. To me it seems like it should be true for infinite $A$, $B$, but a proof is oddly hard to come by. Is there a quick proof or counterexample?