• Source
    1. #include <iostream>
    2.  
    3.  
    4. struct A
    5. {
    6. int v = 3;
    7. };
    8.  
    9.  
    10. namespace Foo
    11. {
    12. template <int k=11>
    13. int operator+(A const& rhs, A const& lhs)
    14. {
    15. return rhs.v + lhs.v + k;
    16. }
    17. }
    18.  
    19. using Foo::operator+;
    20.  
    21.  
    22. using namespace std;
    23. int main()
    24. {
    25.  
    26. A a1, a2;
    27.  
    28. cout << a1 + a2 << endl;
    29.  
    30. return EXIT_SUCCESS;
    31. }
    32.