def has_public_binary_operator(type_, operator_symbol):
type_ = type_traits.remove_alias(type_)<EOL>type_ = type_traits.remove_cv(type_)<EOL>type_ = type_traits.remove_declarated(type_)<EOL>assert isinstance(type_, class_declaration.class_t)<EOL>if type_traits.is_std_string(type_) or type_traits.is_std_wstring(type_):<EOL><INDENT>return True<EOL><DEDENT>operators = type_.member_operators(<EOL>function=matchers.custom_matcher_t(<EOL>lambda decl: not decl.is_artificial) &<EOL>matchers.access_type_matcher_t('<STR_LIT>'),<EOL>symbol=operator_symbol, allow_empty=True, recursive=False)<EOL>if operators:<EOL><INDENT>return True<EOL><DEDENT>declarated = cpptypes.declarated_t(type_)<EOL>const = cpptypes.const_t(declarated)<EOL>reference = cpptypes.reference_t(const)<EOL>operators = type_.top_parent.operators(<EOL>function=lambda decl: not decl.is_artificial,<EOL>arg_types=[reference, None],<EOL>symbol=operator_symbol,<EOL>allow_empty=True,<EOL>recursive=True)<EOL>if operators:<EOL><INDENT>return True<EOL><DEDENT>for bi in type_.recursive_bases:<EOL><INDENT>assert isinstance(bi, class_declaration.hierarchy_info_t)<EOL>if bi.access_type != class_declaration.ACCESS_TYPES.PUBLIC:<EOL><INDENT>continue<EOL><DEDENT>operators = bi.related_class.member_operators(<EOL>function=matchers.custom_matcher_t(<EOL>lambda decl: not decl.is_artificial) &<EOL>matchers.access_type_matcher_t('<STR_LIT>'),<EOL>symbol=operator_symbol, allow_empty=True, recursive=False)<EOL>if operators:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>
returns True, if `type_` has public binary operator, otherwise False