If $g(b) - g(a) = 0$, then $g(a) = g(b)$ and the claim follows from
R1074: Rolle's theorem. Assume thus that $g(b) - g(a) \neq 0$ and consider a function $h : [a, b] \to \mathbb{R}$ given by
\begin{equation}
h(x) = f(x) - \frac{f(b) - f(a)}{g(b) - g(a)} g(x)
\end{equation}
Now
\begin{equation}
\begin{split}
h(b) - h(a) = f(b) - f(a) - \frac{f(b) - f(a)}{g(b) - g(a)} (g(b) - g(a)) = 0
\end{split}
\end{equation}
That is, $h(a) = h(b)$. Moreover, $h$ is continuous on $[a, b]$ and differentiable on $(a, b)$ since $f$ and $g$ are. Therefore,
R1074: Rolle's theorem implies that there exists $c \in (a, b)$ such that
\begin{equation}
h'(c) = f'(c) - \frac{f(b) - f(a)}{g(b) - g(a)} g'(c) = 0
\end{equation}
and equivalently
\begin{equation}
f'(c) (g(b) - g(a)) = g'(c)(f(b) - f(a))
\end{equation}
$\square$