Get page id of current page from template [duplicate]

To get the ID of the page being queried from outside the loop or before the global post object has been set, use get_queried_object_id().

<?php
/**
 * Template Name: Contact Page 
 */

get_header();
?>

<?php
$page_id = get_queried_object_id();
echo get_post_meta( $page_id, 'contact_page', true);
?>

<?php get_footer() ?>