Conformal transformations in classical gravitational theories and in cosmology