Author of question flags only nodes that are answer to his question (node reference)
Are they 2 nodes or 2 node types? If types, just create 2 separate .tpl files for them (node--type1.tpl.php and node--type2.tpl.php).

If they are the same content type, you can check that the node reference exists inside node.tpl.php like so:

Edit: code below now only prints the link if the current user is also the author of the node.

global $user;
if ($user-&gt;uid == $node-&gt;uid &amp;&amp; isset($node-&gt;field_my_reference_field_name[LANGUAGE_NONE)) {
  print flag_create_link('select_answer', $node-&gt;nid);
}