Sir Keir Starmer will be invited to meet EU leaders to discuss European security as Brussels seeks closer ties with the UK, in a significant post-Brexit move.