The sum of two squares in a quadratic field