On the Averaging of a Class of Hybrid Systems