  This paper offers a solution of the functional equation $$
  \big(tf(x)+(1-t)f(y)\big)\varphi(tx+(1-t)y)=tf(x)\varphi(x)+(1-t)f(y)\varphi(y)
  \qquad(x,y\in I), $$ where $t\in\,]0,1[\,$ is a fixed number,
$\varphi:I\to\mathbb{R}$ is strictly monotone, and $f:I\to\mathbb{R}$ is an
arbitrary unknown function. As an immediate application, we shed new light on
the equality problem of Bajraktarevi\'c means with quasi-arithmetic means.
