<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jul 24, 2014 at 2:47 PM, Александр Овчинников <span dir="ltr"><<a href="mailto:sanek23994@gmail.com" target="_blank">sanek23994@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hello,<br></div>Thanks for the answer.<br>
<br></div>Can you clarify the clang description:<br>As I understand we should to move definition of the function to the header file, which contains declaration of the class and the friend function. Am I right? If so, I just think that this doesn't better way.<br>
</div></div></blockquote><div><br></div><div>Doesn't this also work:</div><div><br></div><div>// declaration with default argument comes first</div><div>int func1(int i, int j = 0);</div><div><div><br></div><div>class foo {</div>
<div>// friend decl doesn't use default arguments</div><div>friend int func1(int i, int j);</div><div>public:</div><div> int func();</div><div>};</div><div><br></div><div>int foo::func() { return func1(1); }</div><div>
<br></div><div>// implementation in .cc file</div><div>int func1(int i, int j) { return i + j; }</div><div><br></div><div>int main() {</div><div> foo a;</div><div> a.func();</div><div> return 0;</div><div>}</div>
</div></div></div></div>