In bijective combinatorics, there is another method. Say, both $A$ and $B$ are subsets of a large set $X$ which is split into a "positive" and a "negative" part: $X = X_+ \sqcup X_-$, such that $A,B \subset X_+$. Suppose $\alpha, \beta$ are two sign-reversing involutions on $X$, i.e. such that $\alpha(X_-) \subset X_+$ and $\beta(X_-) \subset X_+$. Suppose further that $A$ is the set of fixed points of $\alpha$ and $B$ is the set of fixed points of $\beta$. Then, obviously, $|A| = |X_+|-|X_-| = |B|$. Moreover, the action of the infinite dihedral group $\ D_\infty = \langle \alpha,\beta\rangle \ $ on $X$ gives a bijection between $A$ and $B$ (take $a \to b$ if they lie in the same orbit).
This idea is known as the "Garsia-Milne involution principle" and can be used to construct bijections proving various partition identities (see here). Other places where a version of this principle comes up is this Zagier's famous proof of Fermat's theorem on sums of two squares, and Doyle & Conway's famous "Division by three" paper (read the "division by 2" section first to understand the connection).