Let S be a semigroup. We determine the complex-valued solutions of the following functional equation
f(xy) + µ(y)f(σ(y)x) = 2f(x)g(y), x, y ∈ S,
where σ : S → S is an automorphism, and µ : S → C is a multiplicative function such that µ(xσ(x)) = 1 for all x ∈ S.