Variational formulation of rate- and state-dependent friction problems