Add forward declaration of operator<< in <string_view> as required.

This declaration was previously missing despite appearing in the
synopsis. Users are still required to include <ostream> to get the
definition of the streaming operator.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372909 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/ostream b/include/ostream
index e6cf9c9..ea38705 100644
--- a/include/ostream
+++ b/include/ostream
@@ -1055,7 +1055,7 @@
 template<class _CharT, class _Traits>
 basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
-           const basic_string_view<_CharT, _Traits> __sv)
+           basic_string_view<_CharT, _Traits> __sv)
 {
     return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size());
 }
diff --git a/include/string_view b/include/string_view
index 3a30db8..8a684a8 100644
--- a/include/string_view
+++ b/include/string_view
@@ -173,6 +173,7 @@
 
 #include <__config>
 #include <__string>
+#include <iosfwd>
 #include <algorithm>
 #include <iterator>
 #include <limits>
@@ -767,6 +768,12 @@
     return __lhs.compare(__rhs) >= 0;
 }
 
+
+template<class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+           basic_string_view<_CharT, _Traits> __str);
+
 typedef basic_string_view<char>     string_view;
 #ifndef _LIBCPP_NO_HAS_CHAR8_T
 typedef basic_string_view<char8_t>  u8string_view;
diff --git a/test/std/strings/string.view/string.view.io/stream_insert_decl_present.pass.cpp b/test/std/strings/string.view/string.view.io/stream_insert_decl_present.pass.cpp
new file mode 100644
index 0000000..be0567a
--- /dev/null
+++ b/test/std/strings/string.view/string.view.io/stream_insert_decl_present.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits, class Allocator>
+//   basic_ostream<charT, traits>&
+//   operator<<(basic_ostream<charT, traits>& os,
+//              const basic_string_view<charT,traits> str);
+
+#include <string_view>
+#include <iosfwd>
+
+template <class SV, class = void>
+struct HasDecl : std::false_type {};
+template <class SV>
+struct HasDecl<SV, decltype(static_cast<void>(std::declval<std::ostream&>() << std::declval<SV&>()))> : std::true_type {};
+
+int main() {
+  static_assert(HasDecl<std::string_view>::value, "streaming operator declaration not present");
+}