$x+iy$ is part of the ideal generated by a+ib iff can be written as $(ac-bd)+i(cb+ad) = (a+ib)(c+id)$.
Solving for $c$ and $d$ we find
d&=(ay-bx)/(a^2 + b^2)
Since $d$ needs to be an integer we have that
$a^2 + b^2 | ay-bx$
From Bézout's Identity we know that $ay-bx$ can be any integer if $a$ and $b$ are coprime, therefore we have $a^2 + b^2$ equivalence classes.
If $a$ and $b$ are not coprime (let $d$ be the GCD) we only have $(a^2 + b^2)/d$ equivalence classes.
I never used a math text editor so I'm sorry about the notation. I feel weird about not using the fact that $a|(x+bd)$ but the rest should be ok.
I would be glad if someone can explain me how to write math here. Thanks.