Two given line segments have the lengths a and b.
Using only a compass and an unmarked straightedge construct a line segment whose length is equal to the harmonic mean of a and b.

Construct a trapezoid whose parallel sides have lengths a and b. Construct a line through the intersection of the diagonals and parallel to the parallel sides.

The line segment determined by the intersections of this line and the other two sides of the trapezoid is the line segment desired.