# t00011 - Friend relationships
## Config
```yaml
compilation_database_dir: ..
output_directory: puml
diagrams:
  t00011_class:
    type: class
    glob:
      - ../../tests/t00011/t00011.cc
    using_namespace:
      - clanguml::t00011
    include:
      namespaces:
        - clanguml::t00011

```
## Source code
File t00011.cc
```cpp
namespace external {
class C { };
}

namespace clanguml {
namespace t00011 {

class B;

template <typename T> class D {
    T value;
};

class A {
public:
    void foo() { }
    friend class B;
    friend class external::C;
    // TODO
    template <typename T> friend class D;
    // TODO
    friend class D<int>;
    friend class D<A>;
};

class B {
public:
    void foo() { m_a->foo(); }
    A *m_a;
};
} // namespace t00011
} // namespace clanguml

```
## Generated UML diagrams
![t00011_class](./t00011_class.svg "Friend relationships")
## Generated JSON models
```json
{
  "diagram_type": "class",
  "elements": [
    {
      "bases": [],
      "display_name": "clanguml::t00011::D<T>",
      "id": "1150639902748052276",
      "is_abstract": false,
      "is_nested": false,
      "is_struct": false,
      "is_template": true,
      "is_union": false,
      "members": [
        {
          "access": "private",
          "is_static": false,
          "name": "value",
          "source_location": {
            "file": "../../tests/t00011/t00011.cc",
            "line": 11
          },
          "type": "T"
        }
      ],
      "methods": [],
      "name": "D",
      "namespace": "clanguml::t00011",
      "source_location": {
        "file": "../../tests/t00011/t00011.cc",
        "line": 10
      },
      "template_parameters": [
        {
          "is_variadic": false,
          "kind": "template_type",
          "name": "T",
          "template_parameters": []
        }
      ],
      "type": "class"
    },
    {
      "bases": [],
      "display_name": "clanguml::t00011::A",
      "id": "1420516952857803719",
      "is_abstract": false,
      "is_nested": false,
      "is_struct": false,
      "is_template": false,
      "is_union": false,
      "members": [],
      "methods": [
        {
          "access": "public",
          "is_const": false,
          "is_defaulted": false,
          "is_implicit": false,
          "is_pure_virtual": false,
          "is_static": false,
          "is_virtual": false,
          "name": "foo",
          "parameters": [],
          "type": "void"
        }
      ],
      "name": "A",
      "namespace": "clanguml::t00011",
      "source_location": {
        "file": "../../tests/t00011/t00011.cc",
        "line": 14
      },
      "template_parameters": [],
      "type": "class"
    },
    {
      "bases": [],
      "display_name": "clanguml::t00011::B",
      "id": "1687427603952049829",
      "is_abstract": false,
      "is_nested": false,
      "is_struct": false,
      "is_template": false,
      "is_union": false,
      "members": [
        {
          "access": "public",
          "is_static": false,
          "name": "m_a",
          "source_location": {
            "file": "../../tests/t00011/t00011.cc",
            "line": 29
          },
          "type": "clanguml::t00011::A *"
        }
      ],
      "methods": [
        {
          "access": "public",
          "is_const": false,
          "is_defaulted": false,
          "is_implicit": false,
          "is_pure_virtual": false,
          "is_static": false,
          "is_virtual": false,
          "name": "foo",
          "parameters": [],
          "type": "void"
        }
      ],
      "name": "B",
      "namespace": "clanguml::t00011",
      "source_location": {
        "file": "../../tests/t00011/t00011.cc",
        "line": 26
      },
      "template_parameters": [],
      "type": "class"
    }
  ],
  "metadata": {
    "clang_uml_version": "0.3.5-27-g81c7ce7",
    "llvm_version": "Ubuntu clang version 15.0.6",
    "schema_version": 1
  },
  "name": "t00011_class",
  "relationships": [
    {
      "access": "public",
      "destination": "1687427603952049829",
      "label": "<<friend>>",
      "source": "1420516952857803719",
      "type": "friendship"
    },
    {
      "access": "public",
      "destination": "1420516952857803719",
      "label": "m_a",
      "source": "1687427603952049829",
      "type": "association"
    }
  ],
  "using_namespace": "clanguml::t00011"
}
```
