4.—(1) Subsections (2) to (5) shall apply where proceedings for the enforcement of a term of a contract are brought by a third party in reliance on section 2.
(2) The promisor shall have available to him, by way of defence or set-off, any matter that —
(a)
arises from or in connection with the contract and is relevant to the term; and
(b)
would have been available to him by way of defence or set-off if the proceedings had been brought by the promisee.
(3) The promisor shall also have available to him, by way of defence or set-off, any matter if —
(a)
an express term of the contract provides for it to be available to him in proceedings brought by the third party; and
(b)
it would have been available to him by way of defence or set-off if the proceedings had been brought by the promisee.
(4) The promisor shall also have available to him —
(a)
by way of defence or set-off any matter; and
(b)
by way of counterclaim any matter not arising from the contract,
that would have been available to him by way of defence or set-off or by way of counterclaim against the third party, as the case may be, if the third party had been a party to the contract.
(5) Subsections (2) and (4) are subject to any express term of the contract as to the matters that are not to be available to the promisor by way of defence, set-off or counterclaim.
(6) Where, in any proceedings brought against him, a third party seeks to enforce a term of a contract (including, in particular, a term purporting to exclude or limit liability) in reliance on section 2, he may not do so if he could not have done so (whether by reason of any particular circumstances relating to him or otherwise) had he been a party to the contract.