Let $A'$ be the number of heads on the second toss so that $A+A'=B$. Using bilinearity of covariance, and independence of $A$ and $A'$, we have
$$Cov(A,B) = Cov(A,A+A') = Cov(A,A)+Cov(A,A') = Var(A) + 0 = Var(A).$$
Let $A'$ be the number of heads on the second toss so that $A+A'=B$. Using bilinearity of covariance, and independence of $A$ and $A'$, we have
$$Cov(A,B) = Cov(A,A+A') = Cov(A,A)+Cov(A,A') = Var(A) + 0 = Var(A).$$