Euler-Lagrange equations and friction forces 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?
 A: The main point is that Goldstein is not saying we must exclude friction forces in our treatment, but we must place them in the tally of applied forces (that we keep track of in D'Alembert's principle) and not in the other bin of the remaining forces, see this and this Phys.SE posts.
Of course, there does not exist a generalized potential $U$ for the friction forces ${\bf F}=-k {\bf v}$, only the Rayleigh dissipation function, see this Phys.SE post and this mathoverflow post.
A: Actually, at least for a single point subjected to a friction force $F= -\gamma v$ and other forces associated with a potential $U(t,x)$ there exists a Lagrangian: $${\cal L}=e^{t\gamma/m}\left(\frac{m}{2}\dot{x}^2 -U(t,x)\right)\:.$$
The point is that this Lagrangian is not of the form $T-U$, nevertheless it gives rise to the correct equation of motion, the same obtained by using the  Rayleigh dissipation function you mentioned.
This Lagrangian however  cannot be produced by direct application of the principle of virtual works you mention.
