I want an abstract class `A`.

Then I want a class `B` that can only be instantiated by `A`. No one else can access `B` - only `A`.

Then I want `A` to have a method that returns instances of `B`.

My attempt:

```
public abstract class A {

    public static B getInstanceOfB() {
        return new B();
    }

    private class B {

    }

}

```

Which of course doesn't work. How can I achieve this?