  We prove mean value formulas for classical solutions to second order linear
differential equations in the form
  $$
  \partial_t u = \sum_{i,j=1}^m X_i (a_{ij} X_j u) + X_0 u + f,
  $$ where $A = (a_{ij})_{i,j=1, \dots,m}$ is a bounded, symmetric and
uniformly positive matrix with $C^1$ coefficients under the assumption that the
operator $\sum_{j=1}^m X_j^2 + X_0 - \partial_t$ is hypoelliptic and the vector
fields $X_1, \dots, X_m$ and $X_{m+1} :=X_0 - \partial_t$ are invariant with
respect to a suitable homogeneous Lie group. Our results apply e.g. to
degenerate Kolmogorov operators and parabolic equations on Carnot groups
$\partial_t u = \sum_{i,j=1}^m X_i (a_{ij} X_j u) + f$.
