Let me detail the title of the question. I'm trying to give students an intuition of what the class number is.

Let $K=\mathbb{Q}(\sqrt{-d})$, with $d>0$ a square-free integer, be a quadratic imaginary field. Let $\mathcal{O}_K$ be its ring of integers. It is of the form $\mathbb{Z}[\tau]$ with $\tau=\sqrt{-d}$ or $\tau=\frac{1+\sqrt{-d}}{2}$ depending on the value of $d$ mod $4$.

So let us think of $\mathcal{O}_K$ as the lattice of $\mathbb{C}$ generated by $1$ and $\tau$. Then ideals should correspond to sublattices of $\mathcal{O}_K$ and two of them should define the same class in the class group if one can pass from one to another by multiplying by an element of $\alpha$, isn't it?

Could anybody help me to precise this analogy? For instance, how can one see that $\mathbb{Q}(i)$ has class number 1 but $\mathbb{Q}(\sqrt{-5})$ doesn't just by looking at the corresponding lattices? The (non-equivalent) decompositions

$2.3=(1+\sqrt{5}i)(1-\sqrt{5}i)$

suggest to consider the lattices $\mathbb{Z}\cdot 2+\mathbb{Z}\cdot(1+\sqrt{5}i)$ and $\mathbb{Z}\cdot 3+\mathbb{Z}\cdot(1-\sqrt{5}i).$ Is that what I have to do?

Thanks!