Theorem (Carlitz, 1960): The ring of integers $\mathbb{Z}_F$ of an algebraic number field $F$ has class number at most $2$ iff for all nonzero nonunits $x \in \mathbb{Z}_F$, any two factorizations of $x$ into irreducibles have the same number of factors.

A proof of this (and a 1990 generalization of Valenza) can be found in $\S 22.3$ of my commutative algebra notes.

This paper has spawned a lot of research by ring theorists on **half-factorial domains**: these are rings in which every nonzero nonunit factors into irreducibles and such that the number of irreducible factors is independent of the factorization.

To be honest though, I think there are plenty of number theorists who think of the class number as measuring the failure of unique factorization who don't know Carlitz's theorem (or who know it but are not thinking of it when they make that kind of statement).

Here is another try [**edit: this is essentially the same as Olivier's response, but said differently; I think it is worthwhile to have both**]: when trying to solve certain Diophantine problems (over the integers), one often gets nice results if the class number of a certain number field is prime to a certain quantity. The most famous example of this is Fermat's Last Theorem, which is easy to prove for an odd prime $p$ for which the class number of $\mathbb{Q}(\zeta_p)$ is prime to $p$: a so-called "regular" prime.

For an application to Mordell equations $y^2 + k = x^3$, see

http://math.uga.edu/~pete/4400MordellEquation.pdf

Especially see Section 4, where the class of rings "of class number prime to 3" is defined axiomatically and applied to the Mordell equation. (N.B.: These notes are written for an advanced undergraduate / first year grad student audience.)

The Mordell equation is probably a better example than the Fermat equation because:

(i) the argument in the "regular" case is more elementary than FLT in the regular case (the latter is too involved to be done in a first course), and

(ii) when the "regularity" hypothesis is dropped, it is not just harder to prove that there are no nontrivial solutions, it is actually very often false!

in what different waysdoes UFD fail in your ring, rather than that its size measureshow badthe failure is. – Mariano Suárez-Alvarez♦ Jan 6 '10 at 17:09