The purpose of this paper is to investigate the invariance of the arithmetic
mean with respect to two weighted Bajraktarevi\'c means, i.e., to solve the
functional equation (gf)−1(tg(x)+sg(y)tf(x)+sf(y))+(kh)−1(sk(x)+tk(y)sh(x)+th(y))=x+y(x,y∈I), where f,g,h,k:I→R are unknown continuous
functions such that g,k are nowhere zero on I, the ratio functions f/g,
h/k are strictly monotone on I, and t,s∈R+ are constants
different from each other. By the main result of this paper, the solutions of
the above invariance equation can be expressed either in terms of hyperbolic
functions or in terms of trigonometric functions and an additional weight
function. For the necessity part of this result, we will assume that
f,g,h,k:I→R are four times continuously differentiable