Normally one would add a flag link as field in a view, in order to be able to flag an entity of a views row.

However, I cannot add a flag link to a view that only shows entities using a relationship, since the flag link already uses its own relationship and apparently cannot have another relationship on top of that.

So the question is, how can I add a flag link so that it will flag entities in views rows that use a relationship?

My case:
I have a view based on entities of bundle 'project'. I have added a contextual filter that selects only the currently viewed project entity.
I have added fields of project content that reference the current project, using the entity reference field 'field_project'.
The view shows all content referencing the currently viewed project.
However, the flag that I add to the view does not flag the project content, but the viewed project. Result is that if I press one flag link, all flags appear as flagged in the view.