who wrote beyonce song if i were a boy