We show that a nonnegative function germ at the origin of R 2 belonging to a quasianalytic Denjoy-Carleman class can be written as a sum of two squares of functions which lie in a Denjoy-Carleman class again. When the germ is elliptic we prove that the class is the same, in the general case a loss of regularity is possible. As a consequence we deduce the Artin-Lang property for suitable unions of such quasianalytic classes.