A priori estimates for solutions to a class of obstacle problems under p, q-growth conditions