YouTube27 Nov 2025
56m

Back to Basics: Master C++ Friendship - Mateusz Pusz - CppCon 2025

Podcast cover

CppCon

In this back-to-basics C++ talk, Mateusz Pusz discusses the friend keyword, challenging the common belief that it is inherently evil and breaks encapsulation. He explains the proper use of friends in modern C++, including hidden friends, to improve code and reduce compile times. The talk covers access control, customization points, and various idioms related to friendship, emphasizing that misuse, not the feature itself, is the real problem. Pusz also advises against using friends for unit testing and advocates for better design principles like the Single Responsibility Principle to avoid the need for excessive friendship.

Outlines

Part 1: Introduction, Common Misconceptions

Part 2: Access Control, Operator Overloading

Part 3: Encapsulation, Design Principles

Part 4: Advanced Idioms, Performance

Part 5: Summary, Best Practices

Sign in to continue reading, translating and more.

Open full episode in Podwise