Hmm in theory you should be able to do this with a query but I did remember something like this from long ago exist, I searched but sadly neither version has been updated to work with 4.x but it's similar to your request just not instant 100% friends with everyone per say.
https://vborg.vbsupport.ru/showthread.php?t=188584
https://vborg.vbsupport.ru/showthread.php?t=265929
In the least the queries within the mod will give you insight into it, then cross reference to ensure the tables and such are there and the same within 4.x and run a backup before running any queries

.