[libc++] Granularize <type_traits> includes in <compare>

Reviewed By: Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D140480

GitOrigin-RevId: e0a66116fcccd59d12485810f5311efafa134ea5
diff --git a/include/ostream b/include/ostream
index 1d943d8..5e2099b 100644
--- a/include/ostream
+++ b/include/ostream
@@ -1191,6 +1191,7 @@
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <concepts>
 #  include <iterator>
+#  include <type_traits>
 #endif
 
 #endif // _LIBCPP_OSTREAM