Ireland agrees to take in migrants stranded on Mediterranean rescue ship