Let G be a group with an involution x↦ x∗, let μ: G→ C be a multiplicative function such that μ(xx∗) = 1 for all x∈ G, and let the pair f, g: G→ C satisfy that f(xy)+μ(y)f(xy∗)=2f(x)g(y),∀x,y∈G.For G compact we obtain: If g is abelian, then f is abelian. For G nilpotent we obtain: (1) If G is generated by its squares and f≠ 0 , then g is abelian. (2) If g is abelian, but not a multiplicative function, then f is abelian.