HTC beats analyst forecasts for Q2