EU leaders have struck a deal to put women in two of the most important policy making jobs in the EU for the first time.