This exercise provides a nice illustration of the "wrong square root problem."
If you assume that f and g are positive integers, f < g, and that
x^2  f, x^2  g, and x^2  f*g are irreducible in Q[x],
squaring both sides of the given equation leads to the stated relations, apart from the sign in the square root of b^2  c, which is decided by f < g. Things can be put in terms of f and g as follows:
c = 4*f*g, b = g + f, and sqrt(b^2  c) = g  f.
For example f = 2, g = 3 gives c = 24, b = 5, and
(sqrt(2) + sqrt(3))^2 = 5 + sqrt(24).
However, if f < g < 0, a minus sign goes missing in action, because sqrt(f)*sqrt(g) = sqrt(f*g) (at least, assuming sqrt(f) and sqrt(g) are the positive square roots of f and g, multiplied by the same square root of 1). In this case,
sqrt(b + sqrt(c)) = sqrt(f)  sqrt(g) or sqrt(g)  sqrt(f), depending on whether you want pure imaginary numbers with positive or negative imaginary part.
f = 2, g = 1 give c = 8, b = 3, and b^2  c = 1. Thus
sqrt(3 + sqrt(8)) = sqrt(1)  sqrt(2) or sqrt(2)  sqrt(1).
I leave it to the reader to deal with the case f < 0 < g.
