This?
Maybe they used the same producer or something like that. Sometime things happen behind the scenes that the artists don't know about.
Like when Drake accused Kia Shine of lying because he was taking credit for co-writing "The best I ever had". Drake said that Kia Shine had nothing to do with the record and that he never even met him. But Kia had produced the track for Lil wayne even before it got to Drake. So thats how he got credit for writing the song.