Regularity results for a class of obstacle problems under nonstandard growth conditions