We can derive Lagrange equations supposing that the virtual work of a system is zero.
$$\delta W=\sum_i (\mathbf{F}_i-\dot {\mathbf{p}_i})\delta \mathbf{r}_i=\sum_i (\mathbf{F}^{(a)}_i+\mathbf{f}_i-\dot {\mathbf{p}_i})\delta \mathbf{r}_i=0$$
Where $\mathbf{f}_i$ are the constrainded forces and are supposed to do no work, which it's true in most cases. Quoting Goldstein:
[The principle of virtual work] is no longer true if sliding friction forces are present [in the tally of constraint forces], ...
So I understand that we should exclude friction forces of our treatmeant. After some manipulations we arrive to:
$$\frac{d}{dt}\frac {\partial T}{\partial \dot q_i}-\frac{\partial T}{\partial q_i}=Q_i$$
Further in the book, the Rayleigh dissipation function is introduced to include friction forces. So given that $Q_i=-\frac {\partial \mathcal{F}}{\partial \dot q_i}$ and $L=T-U$, we get:
$$\frac{d}{dt}\frac {\partial L}{\partial \dot q_i}-\frac{\partial L}{\partial q_i}+\frac {\partial \mathcal{F}}{\partial \dot q_i}=0$$
Question: Isn't this an inconsistency of our proof, how do we know the equation holds? Or is it just an educated guess which turns out to be true?