I recently taught an introductory course on Performance Optimization. Here are the slides, without the examples:
While the Pimpl pattern is commonly used to hide implementation and private methods and variables from public interfaces, the common implementations often require a large amount of boilerplate code. This can make it hard to introduce this pattern into a large existing class. If we use bi-directional friend references with the private implementation, we can easily add a small private implementation into an existing class, allowing for better design patterns and performance optimizations to be gently introduced into existing code….