How to add a flag link to a view that contains only fields with relationships
Quote from your own comment:


  I removed the flag, and re-added it, and suddenly the relationship field is available in the flag. The funny thing is that the flag was already present when I changed the view to only contain related entities, and when I tried to edit the flag relation properties, it did not give a field to add a relationship. Removing and readding the flag did help.


So it seems that "removing and readding the flag" is the solution to answer your question.

Credits: Yuri and Niall Murphy.