Article 48 TFEU

The European Parliament and the Council shall, acting in accordance with the ordinary legislative procedure, adopt such measures in the field of social security as are necessary to provide freedom of movement for workers; to this end, they shall make arrangements to secure for employed and selfemployed migrant workers and their dependants:
(a) aggregation, for the purpose of acquiring and retaining the right to benefit and of calculating the amount of benefit, of all periods taken into account under the laws of the several countries;
(b) payment of benefits to persons resident in the territories of Member States.

Where a member of the Council declares that a draft legislative act referred to in the first subparagraph would affect important aspects of its social security system, including its scope, cost or financial structure, or would affect the financial balance of that system, it may request that the matter be referred to the European Council. In that case, the ordinary legislative procedure shall be suspended. After discussion, the European Council shall, within four months of this suspension, either:
(a) refer the draft back to the Council, which shall terminate the suspension of the ordinary legislative procedure; or
(b) take no action or request the Commission to submit a new proposal; in that case, the act originally proposed shall be deemed not to have been adopted.